local skynet    = require "skynet.manager"
local sharedata = require "skynet.sharedata"
local server_config = dofile(skynet.getenv("server_config"))

skynet.start(function()
	skynet.error("Server start")

	if not skynet.getenv "daemon" and server_config.no_cotainer then
		skynet.newservice("console")
	end

	local debug_listen_ip = "127.0.0.1"
	if not server_config.no_cotainer then
		debug_listen_ip = '0.0.0.0'
	end
	skynet.newservice("debug_console",debug_listen_ip, server_config.debug_port)
	
	local proxy_conn = skynet.newservice("proxy_conn")
	skynet.call(proxy_conn, "lua", "start")

	local kafka_queue = skynet.newservice('kafka_queue')
	skynet.name('.kafka_queue',kafka_queue)

	local reload_service = skynet.uniqueservice("reload_service")
	skynet.name(".reload_service", reload_service)
	skynet.call(reload_service, "lua", "pull_conf_data") --拉取配置文件

	-- local msg_handler = skynet.uniqueservice("msg_handler")
	-- skynet.name(".msg_handler", msg_handler)
	-- skynet.call(msg_handler, "lua", "start")

	-- local act_userdata_inter = skynet.newservice("act_userdata_inter")	
	-- skynet.name(".act_userdata_inter",act_userdata_inter)
	-- skynet.call(act_userdata_inter, "lua", "start")

	-- local activity_mgr = skynet.newservice("activity_mgr")	
	-- skynet.name(".activity_mgr", activity_mgr)
	-- skynet.call(activity_mgr, "lua", "start")

	-- local rank_activity_award = skynet.newservice("rank_activity_award")
	-- skynet.name(".rank_activity_award", rank_activity_award)
	-- skynet.call(rank_activity_award, "lua", "start")


	local manager_service = skynet.uniqueservice("manager/manager_service")	
	skynet.call(manager_service, "lua", "start")
	local redis_service = skynet.uniqueservice("redis/redis_service")	
	skynet.name("redis_service", redis_service)
	skynet.call(redis_service, "lua", "start")

	skynet.exit()
end)